<html><head><title>SetGadgetData</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">SetGadgetData()</font></b></p>
<p><b>Syntax</b></p><blockquote>
<font color="#3A3966"><b>SetGadgetData</b></font>(#Gadget, Value)</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Stores the given value with the specified gadget. This value can later be read with the <a href="getgadgetdata.html">GetGadgetData()</a> 
function. This allows to associate a custom value with any gadget. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Gadget</i></td>
<td width="90%"> 
The gadget to use. 

</td></tr>
<tr><td><i>Value</i></td>
<td> 
The value to set. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>
None.


</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; This code uses SetGadgetData to associate an index for the Messages()</font>
  <font color="#3A3966">; array with each button. This makes the event loop simpler as not every</font>
  <font color="#3A3966">; gadget needs to he handled separately.</font>
  <font color="#3A3966">;</font>
  <b><font color="#3A3966">Dim</font></b> <font color="#3A3966">Messages</font>.s(2)
<font color="#3A3966">  Messages</font>(0) = &quot;Good morning&quot;
<font color="#3A3966">  Messages</font>(1) = &quot;Hello World&quot;
<font color="#3A3966">  Messages</font>(2) = &quot;Nothing to say&quot;
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">OpenWindow</font>(0, 0, 0, 190, 100, &quot;SetGadgetData&quot;, <font color="#924B72">#PB_Window_SystemMenu</font> | <font color="#924B72">#PB_Window_ScreenCentered</font>)
<font color="#3A3966">    ButtonGadget</font>(0,  10, 10, 80, 20, &quot;Button&quot;):<font color="#3A3966"> SetGadgetData</font>(0, 1)
<font color="#3A3966">    ButtonGadget</font>(1,  10, 40, 80, 20, &quot;Button&quot;):<font color="#3A3966"> SetGadgetData</font>(1, 2)
<font color="#3A3966">    ButtonGadget</font>(2,  10, 70, 80, 20, &quot;Button&quot;):<font color="#3A3966"> SetGadgetData</font>(2, 1)
<font color="#3A3966">    ButtonGadget</font>(3, 100, 10, 80, 20, &quot;Button&quot;):<font color="#3A3966"> SetGadgetData</font>(3, 2)
<font color="#3A3966">    ButtonGadget</font>(4, 100, 40, 80, 20, &quot;Button&quot;) <font color="#3A3966">; will have the value 0 because nothing was set yet</font>
<font color="#3A3966">    ButtonGadget</font>(5, 100, 70, 80, 20, &quot;Button&quot;)
    <b><font color="#3A3966">Repeat</font></b>
      Event =<font color="#3A3966"> WaitWindowEvent</font>()
      <b><font color="#3A3966">If</font></b> Event = <font color="#924B72">#PB_Event_Gadget</font>
        Value =<font color="#3A3966"> GetGadgetData</font>(<font color="#3A3966">EventGadget</font>())
<font color="#3A3966">        MessageRequester</font>(&quot;Message&quot;,<font color="#3A3966"> Messages</font>(Value))
      <b><font color="#3A3966">EndIf</font></b>
    <b><font color="#3A3966">Until</font></b> Event = <font color="#924B72">#PB_Event_CloseWindow</font>
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="getgadgetdata.html">GetGadgetData()</a>, <a href="getgadgetitemdata.html">GetGadgetItemData()</a>, <a href="setgadgetitemdata.html">SetGadgetItemData()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=setgadgetcolor.html>SetGadgetColor()</a> - <a href="index.html">Gadget Index</a> - <a href="setgadgetfont.html">SetGadgetFont()</a> -><br><br>

</body></html>